package com.bitnei.battery.examples;


import com.bitnei.battery.bean.dataBean.product.Module;
import com.bitnei.battery.bean.dataBean.product.Pack;
import com.bitnei.battery.bean.dataBean.product.VehBaseInfo;
import com.bitnei.battery.constants.VehicleType;

import java.util.ArrayList;
import java.util.List;

/**
 * author : czl
 * email : czl_nylg@163.com
 * createTime : 2018-03-05
 * Description: 示例
 */
public class ProductExample {

    public static void main(String[] args){
        //请求地址
        String url = "http://192.168.1.113:8999/bitnei/v1.0/battery/receiveVehicleOld";
        //组装数据
        List<VehBaseInfo> vehList = mockVeh();
        //调用接口
        ApiUtilExample.callApi(url,vehList);
    }


    /**
     * 模拟车辆数据
     * @return
     */
    private static List<VehBaseInfo> mockVeh(){
        List<VehBaseInfo> vehList = new ArrayList<>();
        VehBaseInfo veh = new VehBaseInfo();
        veh.setVin("J345S4PBK24EYR45X");
        veh.setOfflineProductionTime("2018-02-01 00:00:01");
        veh.setVehicleBrand("宝马");
        veh.setVehicleName("汗血宝马");
        veh.setVehModelName("CV-X");
        veh.setVehicleType(VehicleType.CY.getCode());
        veh.setPackList(mockPack());
        vehList.add(veh);
        return vehList;
    }


    /**
     * 模拟电池包数据
     * @return
     */
    private static List<Pack> mockPack(){
        List<Pack> packList = new ArrayList<>();
        Pack pack = new Pack();
        pack.setCode("3XNWGUCKMYUR5NAMN0MUNPW9");
        pack.setModuleList(mockModule());
        packList.add(pack);
        return packList;
    }



    /**
     * 模拟电池模块数据
     * @return
     */
    private static List<Module> mockModule(){
        List<Module> moduleList = new ArrayList<>();
        Module module = new Module();
        module.setCode("3TYNXH54J7DXUTK0BQZINW1H");
        List<String> cellList = new ArrayList<>();
        cellList.add("A66LPQTFZFJZKFK5O39F2M4I");
        module.setCellList(cellList);
        moduleList.add(module);
        return moduleList;
    }

}
